#pragma once

#include "slip_context.hpp"
#include "slip_packet.hpp"

namespace limbo::slip {

template <typename NextState> struct State {
  using Context = SlipContext<State>;
  using Packet = SlipPacket<State>;
  using LowerState = NextState;
  using non_frameable = std::false_type;

  Result recv(Chunk buff, LowerState *lower_state) {
    return packet.recv(buff, *this, lower_state);
  }

  Packet &get_parsed() { return packet; }

  Packet packet;
  uint16_t position = 0;
  int16_t offset = 0;
};

} // namespace limbo::slip
